package com.example.shop_car_2208.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.shop_car_2208.entity.UserEntity

@Dao
interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertUser(user: UserEntity)
    @Update
    suspend fun upDateUser(user: UserEntity)
    @Delete
    suspend fun deleteUser(user: UserEntity)
    @Query("delete from user_info")//drop 删除表的关键词
    suspend fun deleteAll()
    @Query("select * from user_info")
    suspend fun getUser():List<UserEntity>
    @Query("select * from user_info where id=:id")
    suspend fun getUserById(id:Int):UserEntity?
}